package cn.ibizlab.odoo.core.odoo_project.service.impl;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import java.util.Collection;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import cn.ibizlab.odoo.core.client.model.Iproject_project;
import cn.ibizlab.odoo.core.odoo_project.domain.Project_project;
import cn.ibizlab.odoo.core.odoo_project.filter.Project_projectSearchContext;
import cn.ibizlab.odoo.core.odoo_project.service.IProject_projectService;
import cn.ibizlab.odoo.util.SearchResult;
import cn.ibizlab.odoo.util.log.IBIZLog;

/**
 * 实体[项目] 服务对象接口实现
 */
@Slf4j
@IBIZLog
@Service
public class Project_projectServiceImpl implements IProject_projectService {

    @Autowired
    private cn.ibizlab.odoo.core.client.service.Iproject_projectClientService project_projectClientService;

    @Override
    public Project_project get(Integer id) {
        Iproject_project clientModel = project_projectClientService.createModel();
        clientModel.setId(id);
        project_projectClientService.get(clientModel) ;
        return this.convert2Domain(clientModel,null);
    }

    @Override
    public Project_project get(Project_project project_project) {
        Project_project retproject_project = this.get(project_project.getId()) ;
    	BeanCopier copier=BeanCopier.create(retproject_project.getClass(), project_project.getClass(), false);
        copier.copy(retproject_project, project_project, null);
        return project_project ;
    }

    @Override
    public void updateBatch(List<Project_project> project_projects, int batchSize) {

        //project_projectClientService.updateBatch(project_projects,batchSize) ;

    }

    @Override
    public boolean update(Project_project project_project) {
        boolean bOk = false ;
        Iproject_project clientModel = this.convert2Model(project_project,null);
        project_projectClientService.update(clientModel) ;
        this.convert2Domain(clientModel,project_project) ;
        bOk = true;
        return bOk ;
    }

    @Override
    public boolean create(Project_project project_project) {
        boolean bOk = false ;
        Iproject_project clientModel = this.convert2Model(project_project,null);
        project_projectClientService.create(clientModel) ;
        this.convert2Domain(clientModel,project_project);
        bOk = true ;

        return bOk ;
    }

    @Override
    public void removeBatch(Collection<? extends Serializable> idList, int batchSize) {

        //project_projectClientService.removeBatch(project_projects) ;

    }

    @Override
    public boolean remove(Integer id) {
        boolean bOk = false ;
        Iproject_project clientModel = project_projectClientService.createModel();
        clientModel.setId(id);
        project_projectClientService.remove(clientModel) ;
        bOk = true ;
        return bOk ;
    }

    @Override
    public void createBatch(List<Project_project> project_projects, int batchSize) {

                        //project_projectClientService.createBatch(project_projects,batchSize) ;

    }

    /**
     * 查询集合 默认查询
     */
    @Override
    public Page<Project_project> searchDefault(Project_projectSearchContext context) {
        List<Project_project> list = new ArrayList<Project_project>();
        Page<cn.ibizlab.odoo.core.client.model.Iproject_project> clientModelList = project_projectClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iproject_project clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Project_project>(list, context.getPageable(), clientModelList.getTotalElements());
    }


    /**
     * 根据EMail别名查询
     */
    @Override
    public Page<Project_project> selectByOdoo_alias(Integer id){
        Project_projectSearchContext context = new Project_projectSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Project_project> list = new ArrayList<Project_project>();
        Page<cn.ibizlab.odoo.core.client.model.Iproject_project> clientModelList = project_projectClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iproject_project clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Project_project>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据项目查询
     */
    @Override
    public Page<Project_project> selectByOdoo_subtask_project(Integer id){
        Project_projectSearchContext context = new Project_projectSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Project_project> list = new ArrayList<Project_project>();
        Page<cn.ibizlab.odoo.core.client.model.Iproject_project> clientModelList = project_projectClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iproject_project clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Project_project>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据资源工作时间查询
     */
    @Override
    public Page<Project_project> selectByOdoo_resource_calendar(Integer id){
        Project_projectSearchContext context = new Project_projectSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Project_project> list = new ArrayList<Project_project>();
        Page<cn.ibizlab.odoo.core.client.model.Iproject_project> clientModelList = project_projectClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iproject_project clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Project_project>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据公司查询
     */
    @Override
    public Page<Project_project> selectByOdoo_company(Integer id){
        Project_projectSearchContext context = new Project_projectSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Project_project> list = new ArrayList<Project_project>();
        Page<cn.ibizlab.odoo.core.client.model.Iproject_project> clientModelList = project_projectClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iproject_project clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Project_project>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据联系人查询
     */
    @Override
    public Page<Project_project> selectByOdoo_partner(Integer id){
        Project_projectSearchContext context = new Project_projectSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Project_project> list = new ArrayList<Project_project>();
        Page<cn.ibizlab.odoo.core.client.model.Iproject_project> clientModelList = project_projectClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iproject_project clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Project_project>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Project_project> selectByOdoo_create(Integer id){
        Project_projectSearchContext context = new Project_projectSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Project_project> list = new ArrayList<Project_project>();
        Page<cn.ibizlab.odoo.core.client.model.Iproject_project> clientModelList = project_projectClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iproject_project clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Project_project>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Project_project> selectByOdoo_user(Integer id){
        Project_projectSearchContext context = new Project_projectSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Project_project> list = new ArrayList<Project_project>();
        Page<cn.ibizlab.odoo.core.client.model.Iproject_project> clientModelList = project_projectClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iproject_project clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Project_project>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Project_project> selectByOdoo_write(Integer id){
        Project_projectSearchContext context = new Project_projectSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Project_project> list = new ArrayList<Project_project>();
        Page<cn.ibizlab.odoo.core.client.model.Iproject_project> clientModelList = project_projectClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iproject_project clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Project_project>(list, context.getPageable(), clientModelList.getTotalElements());

    }



    public Iproject_project convert2Model(Project_project domain , Iproject_project model) {
        if(domain == null)
            return model ;
        if(model==null){
            model = project_projectClientService.createModel() ;
        }

         if(domain.getAccess_warningDirtyFlag())
            model.setAccess_warning(domain.getAccess_warning());
         if(domain.getMessage_attachment_countDirtyFlag())
            model.setMessage_attachment_count(domain.getMessage_attachment_count());
         if(domain.getDateDirtyFlag())
            model.setDate(domain.getDate());
         if(domain.getDisplay_nameDirtyFlag())
            model.setDisplay_name(domain.getDisplay_name());
         if(domain.getTasksDirtyFlag())
            model.setTasks(domain.getTasks());
         if(domain.getCreate_dateDirtyFlag())
            model.setCreate_date(domain.getCreate_date());
         if(domain.getPercentage_satisfaction_taskDirtyFlag())
            model.setPercentage_satisfaction_task(domain.getPercentage_satisfaction_task());
         if(domain.getAccess_urlDirtyFlag())
            model.setAccess_url(domain.getAccess_url());
         if(domain.getType_idsDirtyFlag())
            model.setType_ids(domain.getType_ids());
         if(domain.get__last_updateDirtyFlag())
            model.set__last_update(domain.get__last_update());
         if(domain.getAccess_tokenDirtyFlag())
            model.setAccess_token(domain.getAccess_token());
         if(domain.getMessage_is_followerDirtyFlag())
            model.setMessage_is_follower(domain.getMessage_is_follower());
         if(domain.getPrivacy_visibilityDirtyFlag())
            model.setPrivacy_visibility(domain.getPrivacy_visibility());
         if(domain.getMessage_follower_idsDirtyFlag())
            model.setMessage_follower_ids(domain.getMessage_follower_ids());
         if(domain.getNameDirtyFlag())
            model.setName(domain.getName());
         if(domain.getRating_status_periodDirtyFlag())
            model.setRating_status_period(domain.getRating_status_period());
         if(domain.getIdDirtyFlag())
            model.setId(domain.getId());
         if(domain.getPercentage_satisfaction_projectDirtyFlag())
            model.setPercentage_satisfaction_project(domain.getPercentage_satisfaction_project());
         if(domain.getDoc_countDirtyFlag())
            model.setDoc_count(domain.getDoc_count());
         if(domain.getFavorite_user_idsDirtyFlag())
            model.setFavorite_user_ids(domain.getFavorite_user_ids());
         if(domain.getColorDirtyFlag())
            model.setColor(domain.getColor());
         if(domain.getWebsite_message_idsDirtyFlag())
            model.setWebsite_message_ids(domain.getWebsite_message_ids());
         if(domain.getTask_countDirtyFlag())
            model.setTask_count(domain.getTask_count());
         if(domain.getIs_favoriteDirtyFlag())
            model.setIs_favorite(domain.getIs_favorite());
         if(domain.getPortal_show_ratingDirtyFlag())
            model.setPortal_show_rating(domain.getPortal_show_rating());
         if(domain.getRating_request_deadlineDirtyFlag())
            model.setRating_request_deadline(domain.getRating_request_deadline());
         if(domain.getMessage_idsDirtyFlag())
            model.setMessage_ids(domain.getMessage_ids());
         if(domain.getMessage_main_attachment_idDirtyFlag())
            model.setMessage_main_attachment_id(domain.getMessage_main_attachment_id());
         if(domain.getMessage_needaction_counterDirtyFlag())
            model.setMessage_needaction_counter(domain.getMessage_needaction_counter());
         if(domain.getMessage_partner_idsDirtyFlag())
            model.setMessage_partner_ids(domain.getMessage_partner_ids());
         if(domain.getActiveDirtyFlag())
            model.setActive(domain.getActive());
         if(domain.getMessage_channel_idsDirtyFlag())
            model.setMessage_channel_ids(domain.getMessage_channel_ids());
         if(domain.getMessage_needactionDirtyFlag())
            model.setMessage_needaction(domain.getMessage_needaction());
         if(domain.getMessage_unread_counterDirtyFlag())
            model.setMessage_unread_counter(domain.getMessage_unread_counter());
         if(domain.getSequenceDirtyFlag())
            model.setSequence(domain.getSequence());
         if(domain.getMessage_has_errorDirtyFlag())
            model.setMessage_has_error(domain.getMessage_has_error());
         if(domain.getWrite_dateDirtyFlag())
            model.setWrite_date(domain.getWrite_date());
         if(domain.getMessage_unreadDirtyFlag())
            model.setMessage_unread(domain.getMessage_unread());
         if(domain.getRating_statusDirtyFlag())
            model.setRating_status(domain.getRating_status());
         if(domain.getLabel_tasksDirtyFlag())
            model.setLabel_tasks(domain.getLabel_tasks());
         if(domain.getTask_idsDirtyFlag())
            model.setTask_ids(domain.getTask_ids());
         if(domain.getMessage_has_error_counterDirtyFlag())
            model.setMessage_has_error_counter(domain.getMessage_has_error_counter());
         if(domain.getDate_startDirtyFlag())
            model.setDate_start(domain.getDate_start());
         if(domain.getPartner_id_textDirtyFlag())
            model.setPartner_id_text(domain.getPartner_id_text());
         if(domain.getCompany_id_textDirtyFlag())
            model.setCompany_id_text(domain.getCompany_id_text());
         if(domain.getCurrency_idDirtyFlag())
            model.setCurrency_id(domain.getCurrency_id());
         if(domain.getAlias_parent_thread_idDirtyFlag())
            model.setAlias_parent_thread_id(domain.getAlias_parent_thread_id());
         if(domain.getAlias_force_thread_idDirtyFlag())
            model.setAlias_force_thread_id(domain.getAlias_force_thread_id());
         if(domain.getWrite_uid_textDirtyFlag())
            model.setWrite_uid_text(domain.getWrite_uid_text());
         if(domain.getAlias_domainDirtyFlag())
            model.setAlias_domain(domain.getAlias_domain());
         if(domain.getAlias_contactDirtyFlag())
            model.setAlias_contact(domain.getAlias_contact());
         if(domain.getAlias_parent_model_idDirtyFlag())
            model.setAlias_parent_model_id(domain.getAlias_parent_model_id());
         if(domain.getAlias_model_idDirtyFlag())
            model.setAlias_model_id(domain.getAlias_model_id());
         if(domain.getCreate_uid_textDirtyFlag())
            model.setCreate_uid_text(domain.getCreate_uid_text());
         if(domain.getAlias_user_idDirtyFlag())
            model.setAlias_user_id(domain.getAlias_user_id());
         if(domain.getAlias_defaultsDirtyFlag())
            model.setAlias_defaults(domain.getAlias_defaults());
         if(domain.getResource_calendar_id_textDirtyFlag())
            model.setResource_calendar_id_text(domain.getResource_calendar_id_text());
         if(domain.getSubtask_project_id_textDirtyFlag())
            model.setSubtask_project_id_text(domain.getSubtask_project_id_text());
         if(domain.getAlias_nameDirtyFlag())
            model.setAlias_name(domain.getAlias_name());
         if(domain.getUser_id_textDirtyFlag())
            model.setUser_id_text(domain.getUser_id_text());
         if(domain.getWrite_uidDirtyFlag())
            model.setWrite_uid(domain.getWrite_uid());
         if(domain.getUser_idDirtyFlag())
            model.setUser_id(domain.getUser_id());
         if(domain.getPartner_idDirtyFlag())
            model.setPartner_id(domain.getPartner_id());
         if(domain.getCompany_idDirtyFlag())
            model.setCompany_id(domain.getCompany_id());
         if(domain.getSubtask_project_idDirtyFlag())
            model.setSubtask_project_id(domain.getSubtask_project_id());
         if(domain.getCreate_uidDirtyFlag())
            model.setCreate_uid(domain.getCreate_uid());
         if(domain.getResource_calendar_idDirtyFlag())
            model.setResource_calendar_id(domain.getResource_calendar_id());
         if(domain.getAlias_idDirtyFlag())
            model.setAlias_id(domain.getAlias_id());
        return model ;
    }

    public Project_project convert2Domain( Iproject_project model ,Project_project domain) {
        if(model == null)
            return domain ;
        if(domain == null){
            domain = new Project_project();
        }

        if(model.getAccess_warningDirtyFlag())
            domain.setAccess_warning(model.getAccess_warning());
        if(model.getMessage_attachment_countDirtyFlag())
            domain.setMessage_attachment_count(model.getMessage_attachment_count());
        if(model.getDateDirtyFlag())
            domain.setDate(model.getDate());
        if(model.getDisplay_nameDirtyFlag())
            domain.setDisplay_name(model.getDisplay_name());
        if(model.getTasksDirtyFlag())
            domain.setTasks(model.getTasks());
        if(model.getCreate_dateDirtyFlag())
            domain.setCreate_date(model.getCreate_date());
        if(model.getPercentage_satisfaction_taskDirtyFlag())
            domain.setPercentage_satisfaction_task(model.getPercentage_satisfaction_task());
        if(model.getAccess_urlDirtyFlag())
            domain.setAccess_url(model.getAccess_url());
        if(model.getType_idsDirtyFlag())
            domain.setType_ids(model.getType_ids());
        if(model.get__last_updateDirtyFlag())
            domain.set__last_update(model.get__last_update());
        if(model.getAccess_tokenDirtyFlag())
            domain.setAccess_token(model.getAccess_token());
        if(model.getMessage_is_followerDirtyFlag())
            domain.setMessage_is_follower(model.getMessage_is_follower());
        if(model.getPrivacy_visibilityDirtyFlag())
            domain.setPrivacy_visibility(model.getPrivacy_visibility());
        if(model.getMessage_follower_idsDirtyFlag())
            domain.setMessage_follower_ids(model.getMessage_follower_ids());
        if(model.getNameDirtyFlag())
            domain.setName(model.getName());
        if(model.getRating_status_periodDirtyFlag())
            domain.setRating_status_period(model.getRating_status_period());
        if(model.getIdDirtyFlag())
            domain.setId(model.getId());
        if(model.getPercentage_satisfaction_projectDirtyFlag())
            domain.setPercentage_satisfaction_project(model.getPercentage_satisfaction_project());
        if(model.getDoc_countDirtyFlag())
            domain.setDoc_count(model.getDoc_count());
        if(model.getFavorite_user_idsDirtyFlag())
            domain.setFavorite_user_ids(model.getFavorite_user_ids());
        if(model.getColorDirtyFlag())
            domain.setColor(model.getColor());
        if(model.getWebsite_message_idsDirtyFlag())
            domain.setWebsite_message_ids(model.getWebsite_message_ids());
        if(model.getTask_countDirtyFlag())
            domain.setTask_count(model.getTask_count());
        if(model.getIs_favoriteDirtyFlag())
            domain.setIs_favorite(model.getIs_favorite());
        if(model.getPortal_show_ratingDirtyFlag())
            domain.setPortal_show_rating(model.getPortal_show_rating());
        if(model.getRating_request_deadlineDirtyFlag())
            domain.setRating_request_deadline(model.getRating_request_deadline());
        if(model.getMessage_idsDirtyFlag())
            domain.setMessage_ids(model.getMessage_ids());
        if(model.getMessage_main_attachment_idDirtyFlag())
            domain.setMessage_main_attachment_id(model.getMessage_main_attachment_id());
        if(model.getMessage_needaction_counterDirtyFlag())
            domain.setMessage_needaction_counter(model.getMessage_needaction_counter());
        if(model.getMessage_partner_idsDirtyFlag())
            domain.setMessage_partner_ids(model.getMessage_partner_ids());
        if(model.getActiveDirtyFlag())
            domain.setActive(model.getActive());
        if(model.getMessage_channel_idsDirtyFlag())
            domain.setMessage_channel_ids(model.getMessage_channel_ids());
        if(model.getMessage_needactionDirtyFlag())
            domain.setMessage_needaction(model.getMessage_needaction());
        if(model.getMessage_unread_counterDirtyFlag())
            domain.setMessage_unread_counter(model.getMessage_unread_counter());
        if(model.getSequenceDirtyFlag())
            domain.setSequence(model.getSequence());
        if(model.getMessage_has_errorDirtyFlag())
            domain.setMessage_has_error(model.getMessage_has_error());
        if(model.getWrite_dateDirtyFlag())
            domain.setWrite_date(model.getWrite_date());
        if(model.getMessage_unreadDirtyFlag())
            domain.setMessage_unread(model.getMessage_unread());
        if(model.getRating_statusDirtyFlag())
            domain.setRating_status(model.getRating_status());
        if(model.getLabel_tasksDirtyFlag())
            domain.setLabel_tasks(model.getLabel_tasks());
        if(model.getTask_idsDirtyFlag())
            domain.setTask_ids(model.getTask_ids());
        if(model.getMessage_has_error_counterDirtyFlag())
            domain.setMessage_has_error_counter(model.getMessage_has_error_counter());
        if(model.getDate_startDirtyFlag())
            domain.setDate_start(model.getDate_start());
        if(model.getPartner_id_textDirtyFlag())
            domain.setPartner_id_text(model.getPartner_id_text());
        if(model.getCompany_id_textDirtyFlag())
            domain.setCompany_id_text(model.getCompany_id_text());
        if(model.getCurrency_idDirtyFlag())
            domain.setCurrency_id(model.getCurrency_id());
        if(model.getAlias_parent_thread_idDirtyFlag())
            domain.setAlias_parent_thread_id(model.getAlias_parent_thread_id());
        if(model.getAlias_force_thread_idDirtyFlag())
            domain.setAlias_force_thread_id(model.getAlias_force_thread_id());
        if(model.getWrite_uid_textDirtyFlag())
            domain.setWrite_uid_text(model.getWrite_uid_text());
        if(model.getAlias_domainDirtyFlag())
            domain.setAlias_domain(model.getAlias_domain());
        if(model.getAlias_contactDirtyFlag())
            domain.setAlias_contact(model.getAlias_contact());
        if(model.getAlias_parent_model_idDirtyFlag())
            domain.setAlias_parent_model_id(model.getAlias_parent_model_id());
        if(model.getAlias_model_idDirtyFlag())
            domain.setAlias_model_id(model.getAlias_model_id());
        if(model.getCreate_uid_textDirtyFlag())
            domain.setCreate_uid_text(model.getCreate_uid_text());
        if(model.getAlias_user_idDirtyFlag())
            domain.setAlias_user_id(model.getAlias_user_id());
        if(model.getAlias_defaultsDirtyFlag())
            domain.setAlias_defaults(model.getAlias_defaults());
        if(model.getResource_calendar_id_textDirtyFlag())
            domain.setResource_calendar_id_text(model.getResource_calendar_id_text());
        if(model.getSubtask_project_id_textDirtyFlag())
            domain.setSubtask_project_id_text(model.getSubtask_project_id_text());
        if(model.getAlias_nameDirtyFlag())
            domain.setAlias_name(model.getAlias_name());
        if(model.getUser_id_textDirtyFlag())
            domain.setUser_id_text(model.getUser_id_text());
        if(model.getWrite_uidDirtyFlag())
            domain.setWrite_uid(model.getWrite_uid());
        if(model.getUser_idDirtyFlag())
            domain.setUser_id(model.getUser_id());
        if(model.getPartner_idDirtyFlag())
            domain.setPartner_id(model.getPartner_id());
        if(model.getCompany_idDirtyFlag())
            domain.setCompany_id(model.getCompany_id());
        if(model.getSubtask_project_idDirtyFlag())
            domain.setSubtask_project_id(model.getSubtask_project_id());
        if(model.getCreate_uidDirtyFlag())
            domain.setCreate_uid(model.getCreate_uid());
        if(model.getResource_calendar_idDirtyFlag())
            domain.setResource_calendar_id(model.getResource_calendar_id());
        if(model.getAlias_idDirtyFlag())
            domain.setAlias_id(model.getAlias_id());
        return domain ;
    }


}
